//
//  BGChooseRootViewControler.m
//  bigMall
//
//  Created by LTOVE on 16/7/6.
//  Copyright © 2016年 thinklev. All rights reserved.
//

#import "BGChooseRootViewControler.h"
#import "BGTabBarViewController.h"
#import "BGNewFeatureViewController.h"

#define BGVersonKey @"Verson"

@implementation BGChooseRootViewControler

+ (void)chooseRootViewControler:(UIWindow *)window
{
    
    //获取当前版本号
    NSString *currentVirson = [NSBundle mainBundle].infoDictionary[@"CFBundleVersion"];
    //获取上一次版本号
    NSString *lastVerson = [[NSUserDefaults standardUserDefaults]objectForKey:BGVersonKey];
    //判断版本号是否一致
    if ([currentVirson isEqualToString:lastVerson]) {
//    if ([currentVirson isEqualToString:lastVerson]) {
        BGTabBarViewController *tabBarVc = [[BGTabBarViewController alloc]init];
        window.rootViewController  = tabBarVc;
    }else{
        BGNewFeatureViewController *newVc = [[BGNewFeatureViewController alloc]init];
        window.rootViewController = newVc;
        [[NSUserDefaults standardUserDefaults]setObject:currentVirson forKey:BGVersonKey];
    }
}

@end
